package 掘金.统计班级中的说谎者;

public class Main {
    public static int solution(int[] A) {
        // Edit your code here
        int count=0;
        int[] t = new int[101];
        for(int a:A)
            t[a]++;
        int left = 0, total=A.length;
        for(int i=0;i<=100;i++){
            if(t[i]==0)
                continue;
            int now_left = left + t[i]-1;
            int now_right = total-now_left-1;
            if(now_left >= now_right)
                count+=t[i];
            left+=t[i];
        }

        return count;
    }

    public static void main(String[] args) {
        // Add your test cases here
         System.out.println(solution(new int[]{100, 100, 100}) == 3);
         System.out.println(solution(new int[]{2, 1, 3}) == 2);
         System.out.println(solution(new int[]{30, 1, 30, 30}) == 3);
         System.out.println(solution(new int[]{19, 27, 73, 55, 88}) == 3);
         System.out.println(solution(new int[]{19, 27, 73, 55, 88, 88, 2, 17, 22}) == 5);
    }
}
